using AForge.Video;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace SilverSea.Video.Tools
{
	public class IPCameraSettingPage : UserControl, IVideoSourcePage
	{
		private IContainer icontainer_0;
		private ComboBox cbxImageQuality;
		private Label labelImageQuality;
		private TextBox txtPassword;
		private Label label6;
		private ComboBox cbxImageResolution;
		private Label label7;
		private TextBox txtLogin;
		private TextBox txtVideoSource;
		private Label label3;
		private Label label9;
		private ComboBox cbxStreamType;
		private Label label8;
		private Label label1;
		private ComboBox cbxFrameRate;
		private Label label2;
		private ComboBox cbxChanel;
		private ComboBox cbxVideoDecoder;
		private Label label5;
		private Label label4;
		private ComboBox cbxProtocol;
		private EventHandler eventHandler_0;
		private bool bool_0;
		private bool bool_1;
		private string string_0 = "Deinterlace Filter";
		public event EventHandler StateChanged
		{
			add
			{
				EventHandler eventHandler = this.eventHandler_0;
				EventHandler eventHandler2;
				do
				{
					eventHandler2 = eventHandler;
					EventHandler value2 = (EventHandler)Delegate.Combine(eventHandler2, value);
					eventHandler = Interlocked.CompareExchange<EventHandler>(ref this.eventHandler_0, value2, eventHandler2);
				}
				while (eventHandler != eventHandler2);
			}
			remove
			{
				EventHandler eventHandler = this.eventHandler_0;
				EventHandler eventHandler2;
				do
				{
					eventHandler2 = eventHandler;
					EventHandler value2 = (EventHandler)Delegate.Remove(eventHandler2, value);
					eventHandler = Interlocked.CompareExchange<EventHandler>(ref this.eventHandler_0, value2, eventHandler2);
				}
				while (eventHandler != eventHandler2);
			}
		}
		public bool Completed
		{
			get
			{
				return this.bool_0;
			}
		}
		public string VideoSource
		{
			get
			{
				return this.txtVideoSource.Text;
			}
			set
			{
				this.txtVideoSource.Text = value;
			}
		}
		public string Login
		{
			get
			{
				return this.txtLogin.Text;
			}
			set
			{
				this.txtLogin.Text = value;
			}
		}
		public string Password
		{
			get
			{
				return this.txtPassword.Text;
			}
			set
			{
				this.txtPassword.Text = value;
			}
		}
		public int StreamType
		{
			get
			{
				return this.cbxStreamType.SelectedIndex;
			}
			set
			{
				this.cbxStreamType.SelectedIndex = value;
			}
		}
		public int ProtocolType
		{
			get
			{
				return this.cbxProtocol.SelectedIndex;
			}
			set
			{
				this.cbxProtocol.SelectedIndex = value;
			}
		}
		public int Chanel
		{
			get
			{
				return this.cbxChanel.SelectedIndex;
			}
			set
			{
				this.cbxChanel.SelectedIndex = value;
			}
		}
		public string Resolution
		{
			get
			{
				return this.cbxImageResolution.Text;
			}
			set
			{
				this.cbxImageResolution.Text = value;
			}
		}
		public string Quality
		{
			get
			{
				return this.cbxImageQuality.Text;
			}
			set
			{
				this.cbxImageQuality.Text = value;
			}
		}
		public int FrameRate
		{
			get
			{
				return this.cbxFrameRate.SelectedIndex;
			}
			set
			{
				this.cbxFrameRate.SelectedIndex = value;
			}
		}
		public bool UsingDeinterlaceFilter
		{
			get
			{
				return this.bool_1;
			}
			set
			{
				this.bool_1 = value;
			}
		}
		public string DeinterlaceFilterName
		{
			get
			{
				return this.string_0;
			}
			set
			{
				this.string_0 = value;
			}
		}
		public int UsingPlugins
		{
			get
			{
				return this.cbxVideoDecoder.SelectedIndex;
			}
			set
			{
				if (value <= 2)
				{
					this.cbxVideoDecoder.SelectedIndex = value;
					return;
				}
				this.cbxVideoDecoder.SelectedIndex = 0;
			}
		}
		public IPCameraSettingPage()
		{
			this.InitializeComponent();
			this.cbxChanel.SelectedIndex = 0;
			this.cbxProtocol.SelectedIndex = 0;
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(IPCameraSettingPage));
            this.cbxImageQuality = new System.Windows.Forms.ComboBox();
            this.labelImageQuality = new System.Windows.Forms.Label();
            this.txtPassword = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.cbxImageResolution = new System.Windows.Forms.ComboBox();
            this.label7 = new System.Windows.Forms.Label();
            this.txtLogin = new System.Windows.Forms.TextBox();
            this.txtVideoSource = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.cbxStreamType = new System.Windows.Forms.ComboBox();
            this.label8 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.cbxFrameRate = new System.Windows.Forms.ComboBox();
            this.label2 = new System.Windows.Forms.Label();
            this.cbxChanel = new System.Windows.Forms.ComboBox();
            this.cbxVideoDecoder = new System.Windows.Forms.ComboBox();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.cbxProtocol = new System.Windows.Forms.ComboBox();
            this.SuspendLayout();
            // 
            // cbxImageQuality
            // 
            resources.ApplyResources(this.cbxImageQuality, "cbxImageQuality");
            this.cbxImageQuality.Name = "cbxImageQuality";
            this.cbxImageQuality.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
            this.cbxImageQuality.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cbxImageQuality.FormattingEnabled = true;
            this.cbxImageQuality.Items.AddRange(new object[]
            {
                "Clarity",
                "Standard",
                "Motion"
            });
            // 
            // labelImageQuality
            // 
            resources.ApplyResources(this.labelImageQuality, "labelImageQuality");
            this.labelImageQuality.Name = "labelImageQuality";
            // 
            // txtPassword
            // 
            resources.ApplyResources(this.txtPassword, "txtPassword");
            this.txtPassword.Name = "txtPassword";
            this.txtPassword.UseSystemPasswordChar = true;
            // 
            // label6
            // 
            resources.ApplyResources(this.label6, "label6");
            this.label6.Name = "label6";
            // 
            // cbxImageResolution
            // 
            resources.ApplyResources(this.cbxImageResolution, "cbxImageResolution");
            this.cbxImageResolution.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbxImageResolution.FormattingEnabled = true;
            this.cbxImageResolution.Items.AddRange(new object[] {
            resources.GetString("cbxImageResolution.Items"),
            resources.GetString("cbxImageResolution.Items1"),
            resources.GetString("cbxImageResolution.Items2"),
            resources.GetString("cbxImageResolution.Items3"),
            resources.GetString("cbxImageResolution.Items4"),
            resources.GetString("cbxImageResolution.Items5"),
            resources.GetString("cbxImageResolution.Items6"),
            resources.GetString("cbxImageResolution.Items7"),
            resources.GetString("cbxImageResolution.Items8"),
            resources.GetString("cbxImageResolution.Items9"),
            resources.GetString("cbxImageResolution.Items10"),
            resources.GetString("cbxImageResolution.Items11")});
            this.cbxImageResolution.Name = "cbxImageResolution";
            // 
            // label7
            // 
            resources.ApplyResources(this.label7, "label7");
            this.label7.Name = "label7";
            // 
            // txtLogin
            // 
            resources.ApplyResources(this.txtLogin, "txtLogin");
            this.txtLogin.Name = "txtLogin";
            // 
            // txtVideoSource
            // 
            resources.ApplyResources(this.txtVideoSource, "txtVideoSource");
            this.txtVideoSource.Name = "txtVideoSource";
            this.txtVideoSource.TextChanged += new System.EventHandler(this.txtVideoSource_TextChanged);
            // 
            // label3
            // 
            resources.ApplyResources(this.label3, "label3");
            this.label3.Name = "label3";
            // 
            // label9
            // 
            resources.ApplyResources(this.label9, "label9");
            this.label9.Name = "label9";
            // 
            // cbxStreamType
            // 
            resources.ApplyResources(this.cbxStreamType, "cbxStreamType");
            this.cbxStreamType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbxStreamType.FormattingEnabled = true;
            this.cbxStreamType.Items.AddRange(new object[] {
            resources.GetString("cbxStreamType.Items"),
            resources.GetString("cbxStreamType.Items1"),
            resources.GetString("cbxStreamType.Items2"),
            resources.GetString("cbxStreamType.Items3")});
            this.cbxStreamType.Name = "cbxStreamType";
            this.cbxStreamType.SelectedIndexChanged += new System.EventHandler(this.cbxStreamType_SelectedIndexChanged);
            // 
            // label8
            // 
            resources.ApplyResources(this.label8, "label8");
            this.label8.Name = "label8";
            // 
            // label1
            // 
            resources.ApplyResources(this.label1, "label1");
            this.label1.Name = "label1";
            // 
            // cbxFrameRate
            // 
            resources.ApplyResources(this.cbxFrameRate, "cbxFrameRate");
            this.cbxFrameRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbxFrameRate.Items.AddRange(new object[] {
            resources.GetString("cbxFrameRate.Items"),
            resources.GetString("cbxFrameRate.Items1"),
            resources.GetString("cbxFrameRate.Items2"),
            resources.GetString("cbxFrameRate.Items3"),
            resources.GetString("cbxFrameRate.Items4"),
            resources.GetString("cbxFrameRate.Items5"),
            resources.GetString("cbxFrameRate.Items6"),
            resources.GetString("cbxFrameRate.Items7"),
            resources.GetString("cbxFrameRate.Items8"),
            resources.GetString("cbxFrameRate.Items9"),
            resources.GetString("cbxFrameRate.Items10"),
            resources.GetString("cbxFrameRate.Items11"),
            resources.GetString("cbxFrameRate.Items12"),
            resources.GetString("cbxFrameRate.Items13"),
            resources.GetString("cbxFrameRate.Items14"),
            resources.GetString("cbxFrameRate.Items15"),
            resources.GetString("cbxFrameRate.Items16"),
            resources.GetString("cbxFrameRate.Items17"),
            resources.GetString("cbxFrameRate.Items18"),
            resources.GetString("cbxFrameRate.Items19"),
            resources.GetString("cbxFrameRate.Items20"),
            resources.GetString("cbxFrameRate.Items21"),
            resources.GetString("cbxFrameRate.Items22"),
            resources.GetString("cbxFrameRate.Items23"),
            resources.GetString("cbxFrameRate.Items24"),
            resources.GetString("cbxFrameRate.Items25"),
            resources.GetString("cbxFrameRate.Items26"),
            resources.GetString("cbxFrameRate.Items27"),
            resources.GetString("cbxFrameRate.Items28"),
            resources.GetString("cbxFrameRate.Items29"),
            resources.GetString("cbxFrameRate.Items30")});
            this.cbxFrameRate.Name = "cbxFrameRate";
            // 
            // label2
            // 
            resources.ApplyResources(this.label2, "label2");
            this.label2.Name = "label2";
            // 
            // cbxChanel
            // 
            resources.ApplyResources(this.cbxChanel, "cbxChanel");
            this.cbxChanel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbxChanel.FormattingEnabled = true;
            this.cbxChanel.Items.AddRange(new object[] {
            resources.GetString("cbxChanel.Items"),
            resources.GetString("cbxChanel.Items1"),
            resources.GetString("cbxChanel.Items2"),
            resources.GetString("cbxChanel.Items3"),
            resources.GetString("cbxChanel.Items4")});
            this.cbxChanel.Name = "cbxChanel";
            // 
            // cbxVideoDecoder
            // 
            resources.ApplyResources(this.cbxVideoDecoder, "cbxVideoDecoder");
            this.cbxVideoDecoder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbxVideoDecoder.FormattingEnabled = true;
            this.cbxVideoDecoder.Items.AddRange(new object[] {
            resources.GetString("cbxVideoDecoder.Items"),
            resources.GetString("cbxVideoDecoder.Items1"),
            resources.GetString("cbxVideoDecoder.Items2")});
            this.cbxVideoDecoder.Name = "cbxVideoDecoder";
            // 
            // label5
            // 
            resources.ApplyResources(this.label5, "label5");
            this.label5.Name = "label5";
            // 
            // label4
            // 
            resources.ApplyResources(this.label4, "label4");
            this.label4.Name = "label4";
            // 
            // cbxProtocol
            // 
            resources.ApplyResources(this.cbxProtocol, "cbxProtocol");
            this.cbxProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbxProtocol.FormattingEnabled = true;
            this.cbxProtocol.Items.AddRange(new object[] {
            resources.GetString("cbxProtocol.Items"),
            resources.GetString("cbxProtocol.Items1"),
            resources.GetString("cbxProtocol.Items2"),
            resources.GetString("cbxProtocol.Items3"),
            resources.GetString("cbxProtocol.Items4")});
            this.cbxProtocol.Name = "cbxProtocol";
            // 
            // IPCameraSettingPage
            // 
            this.Controls.Add(this.cbxProtocol);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.cbxVideoDecoder);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.cbxChanel);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.cbxFrameRate);
            this.Controls.Add(this.cbxImageQuality);
            this.Controls.Add(this.labelImageQuality);
            this.Controls.Add(this.txtPassword);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.cbxImageResolution);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.txtLogin);
            this.Controls.Add(this.txtVideoSource);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label9);
            this.Controls.Add(this.cbxStreamType);
            this.Controls.Add(this.label8);
            resources.ApplyResources(this, "$this");
            this.Name = "IPCameraSettingPage";
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		public void Display()
		{
			this.txtVideoSource.Focus();
			this.txtVideoSource.SelectionStart = this.txtVideoSource.TextLength;
		}
		public bool Apply()
		{
			return true;
		}
		private void txtVideoSource_TextChanged(object sender, EventArgs e)
		{
			this.bool_0 = (this.txtVideoSource.Text.Trim() != string.Empty);
			if (this.eventHandler_0 != null)
			{
				this.eventHandler_0(this, new EventArgs());
			}
		}
		private void cbxStreamType_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.cbxFrameRate.Enabled = (this.cbxImageQuality.Enabled = (this.cbxStreamType.SelectedIndex == 0 || this.cbxStreamType.SelectedIndex == 1));
			this.cbxVideoDecoder.Enabled = (this.cbxStreamType.SelectedIndex == 1);
			if (this.cbxStreamType.SelectedIndex == 0)
			{
				this.cbxVideoDecoder.SelectedIndex = 0;
				return;
			}
			if (this.cbxStreamType.SelectedIndex == 2 || this.cbxStreamType.SelectedIndex == 3)
			{
				this.cbxVideoDecoder.SelectedIndex = 1;
			}
		}
		private void method_0(object sender, KeyPressEventArgs e)
		{
			if (!char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar))
			{
				e.Handled = true;
			}
		}
	}
}
